package gui;

import java.io.File;

import javax.swing.filechooser.FileFilter;

public class JSCFileFilter extends FileFilter {
	
	private String extension = ".jsc";
	private String description = "JSC Dictionary";
	
	/**
	 * @param ext The extension of the file searched
	 * @param desc The description of the extension
	 */
	public JSCFileFilter(String ext, String desc) {
		this.extension = ext;
		this.description = desc;
	}
	
	/* (non-Javadoc)
	 * @see javax.swing.filechooser.FileFilter#accept(java.io.File)
	 */
	public boolean accept(File file) {
		return (file.isDirectory() || file.getName().endsWith(this.extension));
	}
	
	/* (non-Javadoc)
	 * @see javax.swing.filechooser.FileFilter#getDescription()
	 */
	public String getDescription() {
		return this.extension + " - " + this.description;
	}
	
}
